package com.unimod.fsmleditor.action;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.texteditor.ITextEditor;

public class GenerateUniModXmlActionDelegate implements IEditorActionDelegate {

	private ITextEditor editor;
	
	public void selectionChanged(IAction action, ISelection selection) {
	}

	public void run(IAction action) {
		GenerateUniModXmlAction generateAction = new GenerateUniModXmlAction(editor);
		generateAction.run();
	}

	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
		if (targetEditor instanceof ITextEditor) {
			editor = (ITextEditor) targetEditor;
		} else {
			editor = null;
		}
	}
}
